<?php
namespace app\api\controller;
use app\api\common\Common;
use app\api\common\ApiErrDesc;

class User extends Common{

    /**
     * 返回用户相关信息
     */
    public function user_info(){
        $data = $this->params;
        $dataurl = $this->__DATAURL__;
        $userRes = db('user')->field('name, phone, avator, sex')
                             ->where('id', $data['uid'])
                             ->find();
        if($userRes){
            if(!empty($userRes['phone'])){
                $userRes['phone'] = $this->encrypt_info($userRes['phone']);
            }
            if(!empty($userRes['avator'])){
                $userRes['avator'] = $dataurl.$userRes['avator'];
            }
            $this->return_msg(ApiErrDesc::SUCCESS[0], ApiErrDesc::SUCCESS[1], $userRes);
        }
    }

    /**
     * 用户反馈信息
     */
    public function feedback(){
        $data = $this->params;

		$fedata = array();
		$fedata['uid'] = $data['uid'];
		$fedata['message'] = $data['con'];
		$fedata['addtime'] = time();
		$res = db('fankui')->insert($fedata);
		if ($res) {
			$this->return_msg(ApiErrDesc::SUCCESS[0], ApiErrDesc::SUCCESS[1]);
		}else{
			$this->return_msg(ApiErrDesc::ERROR[0], ApiErrDesc::ERROR[1]);
		}
    }
    
    /**
     * 用户商品收藏
     */
    

}